package org.jeecg.enums.car;

/**
 * 车场进出记录 放行类型
 *  0 正常放行 1 收费放行 2 免费放行 3 异常放行
 */
public enum CarReleaseTypeEnum {
    RELEASE_TYPE_0(0, "正常放行"),
    RELEASE_TYPE_1(1, "收费放行"),
    RELEASE_TYPE_2(2, "免费放行"),
    RELEASE_TYPE_3(3,"异常放行"),
    ;

    private Integer code;
    private String desc;

    CarReleaseTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        CarReleaseTypeEnum[] enums = values();
        for (CarReleaseTypeEnum typeEnum : enums) {
            if (value.intValue()  == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        CarReleaseTypeEnum[] enums = values();
        for (CarReleaseTypeEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
